Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented May 15, 2025

Add panic-related clippy lints to fortuna

This PR adds a [lints.clippy] section to the fortuna Cargo.toml file to deny clippy lint rules that guard against panics. This helps prevent potential runtime panics in the codebase.

Specifically, the following panic-related lints are denied:

  • unwrap_used
  • expect_used
  • panic
  • panic_in_result_fn
  • indexing_slicing
  • arithmetic_overflow
  • unwrap_in_result
  • option_unwrap_used
  • result_unwrap_used
  • todo
  • unimplemented
  • unreachable
  • expect_fun_call
  • cast_possible_truncation
  • cast_possible_wrap
  • cast_sign_loss
  • cast_precision_loss
  • unchecked_duration_subtraction
  • float_arithmetic
  • float_cmp
  • modulo_one
  • integer_division
  • try_err

Note on Implementation

Running the pre-commit hooks with these lints enabled shows over 65 lint errors in the codebase. Fixing all of these would require significant refactoring, including:

  1. Replacing .unwrap() and .expect() calls with proper error handling
  2. Replacing indexing operations with .get() or .get_mut() to avoid potential panics
  3. Addressing floating-point arithmetic and casting issues

Test Configuration

Note that these lints will also apply to test code. To exclude tests from these lint rules, code-level attributes should be used in test modules or functions:

#[cfg(test)]
mod tests {
    #[allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)]
    #[test]
    fn test_something() {
        // Test code that uses unwrap(), expect(), etc.
    }
}

As requested, I've added the lints but have not made the extensive code changes required to fix all the errors.

Link to Devin run: https://app.devin.ai/sessions/7628ce4c804a45eea59d57847ac320d3

Requested by: Jayant Krishnamurthy

@vercel
Copy link

vercel bot commented May 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2025 3:31pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2025 3:31pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2025 3:31pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2025 3:31pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2025 3:31pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2025 3:31pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2025 3:31pm

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration
Copy link
Contributor Author

Closing due to inactivity for more than 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants